package cn.task.config;

import cn.task.store.MongoChatMemoryStore;
import dev.langchain4j.memory.chat.ChatMemoryProvider;
import dev.langchain4j.memory.chat.MessageWindowChatMemory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;

/**
 @author Mengru Jiao
 @date 2025/5/28
 @project java-ai-langchain4j
 */
@Configuration
public class SeparateChatAssistantConfig {
    @Autowired
    private MongoChatMemoryStore mongoChatMemoryStore;
    @Bean
    public ChatMemoryProvider chatMemoryProvider() {
        return memoryId-> MessageWindowChatMemory.builder().
                id(memoryId).maxMessages(10).
                chatMemoryStore(mongoChatMemoryStore).
                build();
    }
}
